<?php

namespace Biz\model\activity;

use Doraemon\pockets\datebase\BaseDbModel;


class ActivityArchive extends BaseDbModel
{
    const _CONFIG_FILE_ = 'db_store';

    const _CONFIG_SELECT_ = 'db_brand_activity';

    const _DATABASE_ = 'brand_activity';

    const _TABLE_NAME = 'activity_archive';


    public static function addData(array $data = []): int
    {
        $id = $data['id'] ?? 0;
        if (empty($data['created_at'])) $data['created_at'] = date('Y-m-d H:i:s');
        if ($id > 0) $data['updated_at'] = date('Y-m-d H:i:s');
        return $id > 0 ? self::update($data, ['id' => $id])->rowCount() : self::insert($data)->rowcount();
    }

}